/* See the file "LICENSE" for the full license governing this code. */

package com.plugandcare.graphyty.model;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Data model of body weight. Modeled using OpenEHR archetype
 * openEHR-EHR-OBSERVATION.body_weight.v1.
 * 
 * @author Steven Mohr
 */
public class BodyWeight extends VitalSign{
    
    /**
     * Constant for the unit "kilogram".
     */
    public static final String UNIT_KG = "kg";
    /**
     * Constant for the unit "pound".
     */
    public static final String UNIT_LBS = "lbs";

    private double weight;


    public void setWeight(double weight) {
        this.weight = weight;
    }

    public double getWeight() {
        return weight;
    }

    /**
     * {@inheritDoc}
     */
    public String toString() {
        return "Weight: " + weight + unit + " (@" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(timestamp)) + ")";
    }
    
    @Override
    public String getMeasurement() {
        return weight + " " + unit;
    }
}
